@echo off

SETLOCAL ENABLEDELAYEDEXPANSION

set uz_tool="C:\Program Files\7-Zip\7z.exe"
rem set ws_base=E:\workspaces\eclipse\bc_hscs20\Sources\app\hsbcs-full\hsbcs-comnsvc

if not defined ws_base (
set ws_base="%~dp0"
)

set site_type=%1

goto !site_type!

echo error_arg
pause

:nciis
set prj_name=hsbcs-csvc-sms-facade
set rel_prj_path=hsbcs-csvc-sms\%prj_name%
goto toStart

:ca
set prj_name=hsbcs-csvc-ca-facade
set rel_prj_path=hsbcs-csvc-ca\%prj_name%
goto toStart

:ocr
set prj_name=hsbcs-csvc-ocr-facade
set rel_prj_path=hsbcs-csvc-ocr\%prj_name%
goto toStart

:sms
set prj_name=hsbcs-csvc-sms-facade
set rel_prj_path=hsbcs-csvc-sms\%prj_name%
goto toStart

:pay
set prj_name=hsbcs-csvc-pay-facade
set rel_prj_path=hsbcs-csvc-pay\%prj_name%
goto toStart


:toStart
set dir_bk=%cd%

echo starting !site_type!

echo %ws_base%\%rel_prj_path%\target
cd %ws_base%\%rel_prj_path%\target
cd %prj_name%*\bin
if !errorlevel! neq 0 (
if exist %prj_name%*.tar.gz (
%uz_tool% x %prj_name%*.tar.gz
%uz_tool% x %prj_name%*.tar
del %prj_name%*.tar
cd %prj_name%*\bin
)
)

start "!site_type!" start.bat debug

cd %dir_bk%




:eof
ENDLOCAL

pause